﻿<!DOCTYPE HTML>
<html>
<head>
<#include "/script.ftl">
<link rel="stylesheet" type="text/css" href="../static/eth/css/customer.css" />
<script type="text/javascript" src="../lib/layer/2.1/layer.js"></script>
<title>用户详情</title>
</head>
<body>
	<div class="page-container">
		<form id="form" action="save" autocomplete="off">
			<input type="hidden" name="deptId" value="${dept.deptId!}">
			<input  type="hidden" name="deptCode" value="${dept.deptCode!}"  id="deptCode" class="input-text deptCode" >
			
			<div class="row cl mt-10">
				<label class="form-label col-sm-6 text-r">部门名称</label>
				<div class="formControls col-sm-6">
					<input  type="text" name="deptName" value="${dept.deptName!}"  id="deptName" class="input-text deptName" >
				</div>
			</div>
			<div class="mt-10 text-c">
				<input class="btn radius btn-primary"  type="submit" value="提交">
				<input class="btn radius btn-default"  type="button" value="取消" onClick="window.parent.location.reload();" >
			</div>
		</form>
	</div>
<script>
	$("#form").validate({
	 	 rules:{
            deptName : {  
                required:true
            }
        },
        messages:{
        	deptName : {
        		required:"请输入部门名称"
        	}
        },
		debug:true,
		onkeyup:false,
		focusCleanup:false,
		success:"valid",
		invalidHandler: function(form, validator) {return false;},
		submitHandler: function(form) {
			var json = $('#form').serialize();  
	        $.ajax({  
	          type : 'get',  
	          contentType : 'application/json',  
	          url : 'save?' + json,  
	          success : function(data) {
	        	  var rsult = jQuery.parseJSON(data);
	        	  if (rsult.success) {
	        		 alert("部门保存成功！");
	        		 window.parent.location.reload();
	        	  } else {
	        		 alert("部门保存失败!" + rsult.message);
	        	  }
	          },  
	          error : function(data) {  
	              alert("系统错误！")  
	          }  
	        });
	        return false;
		}
	});
</script>
</body>
</html>
